home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Scene Storm
/
Scene Storm - Volume 1.iso
/
coding
/
asm
/
games
/
readcd32padfixed
/
cd32_2.s
Wrap
Text File
|
1980-01-03
|
2KB
|
85 lines
waitvb: cmp.b #100,$dff006
bne.s waitvb
lea CD32_Buttons1(pc),a0 ;a0.l = switches
bsr Readpad1_CD32
tst.b CD32_REWIND1
beq.s no_rwd
move.w #$000,$dff180
no_rwd tst.b CD32_FORWARD1
beq.s no_ffw
move.w #$fff,$dff180
no_ffw tst.b CD32_PLAY1
beq.s no_p
move.w #$0ff,$dff180
no_p tst.b CD32_YELLOW1
beq.s no_y
move.w #$ff0,$dff180
no_y tst.b CD32_GREEN1
beq.s no_g
move.w #$0f0,$dff180
no_g tst.b CD32_RED1
beq.s no_r
move.w #$f00,$dff180
no_r tst.b CD32_BLUE1
beq.s no_b
move.w #$00f,$dff180
no_b
btst #6,$bfe001
bne.w waitvb
rts
CD32_Buttons1: ds.b 1 ;unused.. reserved
CD32_BLUE1 ds.b 1 ;blue button (ALSO same as :RMB)
CD32_RED1 ds.b 1 ;red button (ALSO same as :LMB)
CD32_YELLOW1 ds.b 1 ;yellow button
CD32_GREEN1 ds.b 1 ;green button
CD32_FORWARD1 ds.b 1 ;fast forward button
CD32_REWIND1 ds.b 1 ;rewind button
CD32_PLAY1 ds.b 1 ;play button
******************************************************************************
* CD32 Controller (Port Input) Switch Reader
* ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
******************************************************************************
_custom = $dff000
vhpos = 6
potgo = $34
potinp = $16
ciaaddra = $bfe201
ciaapra = $bfe001
cnop 0,4
Readpad1_CD32: lea ciaapra,a5 ;a5 = $bfe001 ciaa base
lea _custom,a6 ;a6 = $dff000 custom base
moveq #0,d1 ;erase d1
move.l d1,(a0) ;clear em all
move.l d1,4(a0) ;all of them!
moveq #7,d3 ;d3.w = constant
move.w #$6f00,potgo(a6) ;setup port
bset d3,ciaaddra-ciaapra(a5) ;start cia
getswitch: move.w potinp(a6),d0 ;read current port input
bset d3,(a5) ;start cia
move.b vhpos(a6),d2
.catchraster cmp.b vhpos(a6),d2 ;wait 1 raster
beq.s .catchraster
bclr d3,(a5) ;stop cia
addq.w #1,d1 ;next switch
andi.w #1<<14,d0 ;test bit 14
bne.s not_on
st.b (a0,d1.w) ;set switch
not_on: cmp.w d3,d1 ;is this switch ON????
ble.s getswitch
bclr d3,ciaaddra-ciaapra(a5) ;clear cia
move.w #-1,potgo(a6) ;clear port
rts